package eolica

class User {
	
	String login
	String password
	String firstName
	String lastName
	String type
	
	static constraints = {
		login blank:false, size:5..15,matches:/[\S]+/, unique:true
		password blank:false, size:5..15,matches:/[\S]+/
		firstName blank:false
		lastName blank:false
		type(blank: false, inList:["administrador", "ordinario"])		
	}
	
	boolean ehAdministrator() {
		return type.equalsIgnoreCase("administrador")
	}
}
